<?php

include 'api.php';

include("../WeSql/widget.php");
include("../WeSql/config.php");
include("../WeSql/WeSql.php");

/**
 * @var $isTime
 * @var $key
 * @var $config
 * @var $isIpBlack
 * @var $isUserBlack
 */

//文件上传

/*
 * 1.账号判断
 */

@$time = $_REQUEST['time'];
/** @var 账号 $_REQUEST */
@$user = $_REQUEST['user'];
/** @var 密码 $_REQUEST */
@$pass = $_REQUEST['pass'];

$weSql = new WeSql($config,$key);

isIpBlack($weSql, getIP());

if($user == "" or $pass == ""){
    $code = -1;
    $msg = "不能留空";
    $exception = "";
}else{
    isTime($time);
    if(isUser($weSql,$user)) {
        isUserBlack($weSql, $user);
        isPassWord($weSql, $user, $pass);

    }else{
        $code = -1;
        $msg = "账号不存在";
        $exception = "数据库里信息找不到该记录账号";
    }
}


/** @var $code
 * @var $msg
 * @var $exception
 */
@$result = [
    'code' => $code,
    'msg' => $msg,
    'exception' => $exception
];
echo json_encode($result,JSON_UNESCAPED_UNICODE);

